package com.bw.zg3park2212.adpter

import android.widget.TextView
import com.bw.base.entity.MsgEntityItem
import com.bw.zg3park2212.R
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder

class MsgAdpter:BaseQuickAdapter<MsgEntityItem,BaseViewHolder>(R.layout.item_msg) {
    override fun convert(helper: BaseViewHolder, item: MsgEntityItem) {
        helper.setText(R.id.msg_title,item.messageType)
        helper.setText(R.id.msg_time,item.sendTime)
        helper.setText(R.id.msg_cont,item.messageContent)
        val msg_suate = helper.getView<TextView>(R.id.msg_suate)
        if (item.messageStatus=="已读"){
            msg_suate.setTextColor(context.resources.getColor(R.color.white))
            msg_suate.setBackgroundResource(R.drawable.bg_yidu)
            msg_suate.text="已读"
        }else if(item.messageStatus=="处理中"){
            msg_suate.setTextColor(context.resources.getColor(R.color.white))
            msg_suate.setBackgroundResource(R.drawable.bg_chulizhong)
            msg_suate.text="处理中"
        }else if(item.messageStatus=="已过期"){
            msg_suate.setTextColor(context.resources.getColor(R.color.white))
            msg_suate.setBackgroundResource(R.drawable.bg_weidu)
            msg_suate.text="已过期"
        }else{
            msg_suate.setTextColor(context.resources.getColor(R.color.white))
            msg_suate.setBackgroundResource(R.drawable.bg_weidu)
            msg_suate.text="未读"
        }
    }
}